﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace UI.Control
{
    public partial class Button : UserControl
    {
        // Fields...
        private bool _Checked;

        public virtual bool Checked
        {
            get { return _Checked; }
            set
            {
                _Checked = value;
                if (value)
                {btn.FlatStyle = FlatStyle.Standard;
                    btn.ForeColor = Color.Red;
                    
                }
                else
                {
                    btn.FlatStyle = FlatStyle.Flat;
                    btn.ForeColor = Color.Gray;
                }
                if (CheckedChange != null)
                {
                    CheckedChange(this, new EventArgs());
                }
            }
        }

        public delegate void CheckedChangeHandler(Button sender, EventArgs e);
        public event CheckedChangeHandler CheckedChange;

        public string ShowText
        {
            get
            {
                return btn.Text;
            }
            set
            {
                btn.Text = value;
            }
        }
        private Font _FontStyle;
        public Font FontStyle
        {
            get { return _FontStyle; }
            set
            {
                _FontStyle = value;
                btn.Font = _FontStyle;
            }
        }
        public string Value { get; set; }
        public Button()
        {
            InitializeComponent();
            btn.Click += new EventHandler(btn_Click);
        }

        void btn_Click(object sender, EventArgs e)
        {
            Checked = !Checked;
        }
    }
}
